<html>
<head><meta charset="utf-8"><title>mir dump v/s tcx.optimized_mir · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/mir.20dump.20v.2Fs.20tcx.2Eoptimized_mir.html">mir dump v/s tcx.optimized_mir</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="232491630"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/mir%20dump%20v/s%20tcx.optimized_mir/near/232491630" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BaSh <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/mir.20dump.20v.2Fs.20tcx.2Eoptimized_mir.html#232491630">(Mar 30 2021 at 20:23)</a>:</h4>
<p>Hello,<br>
I'm trying to gather MIR of a function through <code>rustic_driver::callbacks</code>. However, through <code>self.tcx.optimized_mir(def_id);</code> I'm losing some information like function declaration. Is it possible to get regular mir details(like <code>unpretty=mir</code> dump) through <code>rust_driver::callbacks</code>?</p>



<a name="232491943"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/mir%20dump%20v/s%20tcx.optimized_mir/near/232491943" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/mir.20dump.20v.2Fs.20tcx.2Eoptimized_mir.html#232491943">(Mar 30 2021 at 20:25)</a>:</h4>
<p>are you looking for <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html#method.fn_sig">https://doc.rust-lang.org/nightly/nightly-rustc/rustc_middle/ty/struct.TyCtxt.html#method.fn_sig</a> maybe?</p>



<a name="232492493"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/mir%20dump%20v/s%20tcx.optimized_mir/near/232492493" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/mir.20dump.20v.2Fs.20tcx.2Eoptimized_mir.html#232492493">(Mar 30 2021 at 20:28)</a>:</h4>
<p>MIR is only for control flow, the rest of the info is in normal metadata</p>



<a name="232493842"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/mir%20dump%20v/s%20tcx.optimized_mir/near/232493842" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BaSh <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/mir.20dump.20v.2Fs.20tcx.2Eoptimized_mir.html#232493842">(Mar 30 2021 at 20:36)</a>:</h4>
<p>This works :) If you could point me to how <code>cargo rustc -- -Z unpretty=mir</code> works, it would be great.</p>



<a name="232494273"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/mir%20dump%20v/s%20tcx.optimized_mir/near/232494273" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/mir.20dump.20v.2Fs.20tcx.2Eoptimized_mir.html#232494273">(Mar 30 2021 at 20:40)</a>:</h4>
<p>I think this is it (click on <code>[src]</code>): <a href="https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/util/fn.write_mir_pretty.html">https://doc.rust-lang.org/nightly/nightly-rustc/rustc_mir/util/fn.write_mir_pretty.html</a></p>



<a name="232494611"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/mir%20dump%20v/s%20tcx.optimized_mir/near/232494611" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> BaSh <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/mir.20dump.20v.2Fs.20tcx.2Eoptimized_mir.html#232494611">(Mar 30 2021 at 20:42)</a>:</h4>
<p>Great. Thanks a lot!  (write_* it is :) <br>
)</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>